<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>多个组件示例</title>
</head>

<body>

    <div id="app">
        <app-header></app-header>
        <app-main></app-main>
        <app-footer></app-footer>
    </div>

    <script src="./node_modules/vue/dist/vue.js"></script>
    <script src="component/Header.js"></script>
    <script src="component/Main.js"></script>
    <script src="component/Footer.js"></script>
    <script>
        // 定义局部组件对象
        const ComponentB = {
            template: '<div>这是 {{name}} </div>',
            data() {
                return {
                    name: '局部组件'
                }
            },
        }
        new Vue({
            el: '#app',
            components: {
                // key:value   ;  key为组件名，value是组件对象。
                'component-b': ComponentB
            },
            data: {

            }
        })
    </script>

</body>

</html>